import axios from 'axios';

let http = axios.create({tiemout:5000});

// http.interceptors.response.use( response => {
//     const res = response.data;
//     if(res.status == 0) return res.data;
//     else return res.msg
// })
http.interceptors.request.use(config => {
    let token = sessionStorage.getItem('token') || null;
    if(token){
        config.headers['x-token'] = token
    }
    return config
})
http.interceptors.response.use( response => {
    const res = response.data;
    return res.result
})
export default http;
